<?php
namespace App\Models;
use DB;
/**
 * RoleNode.php
 * @author LF
 * @Date 16/7/9 11:29
 * @copyright Copyright© 2016-2016 飞煌科技
 * All Rights Reserved.
 * Code is poetry, thus is life.
 * @author JeffMing
 */
class RoleNode extends BaseModel{
    protected $table = 'role_node';

    public function __construct()
    {
    }

    /***
     * @param $rid
     * 通过角色id删除角色节点数据
     */
    public function delByRoleId($rid){
        return $this->_del(['rid'=>$rid]);
    }

    /***
     * 批量添加数据
     */
    public function batInsertData($data){
        return DB::table($this->table)->insert($data);
    }

    /**
     * @param $rid
     * 根据角色id获取对应的权限
     */
    public function getDataByRoleId($where = [], $fields = "*", $order = ['id' => 'desc']){
        return $this->getAll($where, $fields, $order);
    }

    /**
     * @param $where
     * @return mixed
     * 删除数据
     */
    public function del($where){
        return $this->_del($where);
    }
}